<?php
//uncomment when moved to server - to ensure this page is not accessed from anywhere else
//if ($_SERVER['REMOTE_ADDR'] !== '<your server ip address') {
//  die("You are not a cron job!");
//}

  require_once 'app/Mage.php';
  umask(0);

  //$_SERVER['SERVER_PORT']='443';
  Mage::app();

  //$params = Mage::app()->getRequest()->getParam('files'); // set the filename that is to be imported - file needs to be present in var/import directory  
  

  Mage::log("Lightspeed Update Started");    
  $userModel = Mage::getModel('admin/user');
  $userModel->setUserId(0);
  Mage::getSingleton('admin/session')->setUser($userModel);

  $batchModel = Mage::getModel('lightspeed/lightspeed');   
  //Delete Removed Items
  $batchModel->cleanupProducts();
	
  //Cleanup Categories
  $batchModel->cleanupCategories();
  
  
  
  
  echo 'Lightspeed Update Completed';
  Mage::log("Lightspeed Update Completed, updates: {$updated}, imports: {$imported}");
 ?>